// *************************************
// * Creator:SunnyPaine
// * DateTime:2024/08/14 09:08:34
// * Description:<Description>
// * CopyRight:
// * ***********************************

using System;
using SunnyPaine.Autofac.Extension.Mvvm;
using SunnyPaine.Autofac.Extension.Mvvm.Annotations;
using SunnyPaine.Autofac.Extension.Mvvm.UI;
using SunnyPaine.Autofac.Extension.Stereotype.Attributes;

namespace SunnyPaine.Autofac.Extension.Mvvm.Test.ViewModel
{
    [Controller(Scope = true)]
    public class MainViewModel : BasicViewModel, IMainViewModel
    {
        private IDispathcerService Dispathcer
        {
            get { return base.Container.Resolve<IDispathcerService>(); }
        }


        [Command]
        private void Click()
        {
            Mvvm.ViewCore.IWindow childView = base.ResolveNewView("ChildWindow");
            childView.Show();

            Console.Write("asdfasdfdsaf");
            this.Dispathcer.Invoke(() => { Console.Write("11111111111111"); });

            Mvvm.ViewCore.IWindow mainView = base.ResolveView("MainWindow");
            mainView.Close();
        }
    }
}